﻿using UnityEngine;

namespace ActorSystem
{
    public abstract class SkillBase
    {
        public string Name { get; set; }
        public float CooldownTime { get; set; }
        public float CurrentCooldownTime { get; set; }

        public virtual void Update()
        {
            if (CurrentCooldownTime > 0f)
            {
                CurrentCooldownTime -= Time.deltaTime;
            }
        }

        public void UseSkill()
        {
            if (CurrentCooldownTime <= 0f)
            {
                CurrentCooldownTime = CooldownTime;
                OnUseSkill();
            }
        }

        public virtual void OnUseSkill()
        {
        }
    }

    public abstract class SkillBase<ACTOR, BUFF> : SkillBase where ACTOR : ActorBase where BUFF : BuffBase<ACTOR>
    {
        public BUFF Buff { get; set; }
        public ACTOR Self { get; set; }
    }
}